// learning-controls.js - 学习操作按钮组件
Component({
  properties: {
    currentWord: {
      type: Object,
      value: {
        word: '',
        phonetic: '',
        chinese: '',
        example: '',
        pronunciation: null
      }
    },
    isPlaying: {
      type: Boolean,
      value: false
    },
    pronunciationType: {
      type: String,
      value: 'american'
    },
    playbackSpeed: {
      type: Number,
      value: 1.0
    }
  },
  
  methods: {
    // 播放单词发音 - 只触发事件，实际播放由父组件通过audioManager处理
    playPronunciation: function() {
      const { isPlaying } = this.properties;
      
      // 如果正在播放，触发停止事件
      if (isPlaying) {
        this.triggerEvent('stopplay');
      } else {
        // 触发开始播放事件
        this.triggerEvent('playstart');
      }
    },
    
    // 显示更多例句
    showMoreExamples: function() {
      this.triggerEvent('showexamples');
    }
  }
});